package com.bw.gmall.realtime.app.dws;
//分词工具类
import org.wltea.analyzer.core.IKSegmenter;
import org.wltea.analyzer.core.Lexeme;

import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;

public class IKTest {
//    public static void main(String[] args) {
//        List<String> list = ik("辉煌八维大数据");
//        System.out.println( list);
//    }
    public static List<String>  ik(String str){
        ArrayList<String> list = new ArrayList<>();
        StringReader stringReader = new StringReader(str);
        IKSegmenter ik = new IKSegmenter(stringReader, true);
        try{
            Lexeme next = ik.next();
            while (next != null){
//                System.out.println(next.getLexemeText());
                list.add(next.getLexemeText());
                next = ik.next();
            }
            return list;
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

    }
}
